home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1388 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.9 KB

  1. Path: news.infi.net!usenet
  2. From: nngis@norfolk.infi.net (Greg DiGiorgio)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP NEEDED:  Passing input to an already running program.
  5. Date: 13 Jan 1996 14:55:44 GMT
  6. Organization: Customer of InfiNet
  7. Message-ID: <4d8h5g$jrv@news.infi.net>
  8. References: <30F5BFB6.75CF@cnsunix.albany.edu>
  9. NNTP-Posting-Host: h-dclaiborne.norfolk.infi.net
  10. Mime-Version: 1.0
  11. X-Newsreader: WinVN 0.99.3
  12.  
  13. In article <30F5BFB6.75CF@cnsunix.albany.edu>, np1010@cnsunix.albany.edu 
  14. says...
  15. >
  16. >I posted this about a day ago with no response.  I am a little anxious 
  17. to 
  18. >get this problem solved.
  19. >
  20. >I am writing an application that will "launch" another program called 
  21. >irc.  The problem is I need to pass input to irc once I invoke it from 
  22. >the original program.  IRC will be invoked using the funtion system().  
  23. >Once irc is called it takes input from the keyboard.  This is what I 
  24. have 
  25. >tried so far:
  26.  
  27. As another wrote, I don't know which OS you are talking about, but let's 
  28. assume several. Additionally, I'll also assume that IRC is not your 
  29. program 
  30. so you can't recode it to look for a disk file, for example.
  31.  
  32. First, MS-DOS: 
  33. There is no inherent support for interprogram communication in MS-DOS. 
  34. What 
  35. you can do is use a DOS-only function to fill the keyboard. There is a 
  36. propietary function in Turbo/Borland-C/C++ to do this. The problem is 
  37. that 
  38. MS-DOS is not a multi-tasking OS, so once IRC starts running, your 
  39. program 
  40. suspends. So, there is no way you can control IRC remotely unless you add 
  41. multi-tasking to your program (which you can sort of do by hooking into 
  42. the 
  43. timer interrupt - good luck on that one, you'll have to write a TSR).
  44.  
  45. Second, Windows:
  46. There are several mechanisms you can use to remotely control an 
  47. application 
  48. in Windows.Since Windows does multi-task, your program will continue to 
  49. run 
  50. along with the other. If IRC supports DDE then you can use DDE to control 
  51. IRC. DDE is an interface for interprogram communication. If IRC does not 
  52. support DDE, then you can send keystrokes directly to an application from 
  53. background application. This function is very easy using Visual BASIC and 
  54. its SENDKEY procedure. Under C/C++, it is more work.
  55.  
  56. Third, UNIX - look at the previous poster's comments.
  57.  
  58. >
  59. >-> Using fprintf(stdin, ".....");
  60. >I thought that if I wrote to the stdin file, it would be passed to IRC 
  61. as 
  62. >input from the keyboard.  This didn't work.
  63. >
  64. >-> Using system("...");
  65. >This didn't work either.  it just passed commands to the shell that IRC 
  66. >was running from.
  67. >
  68. >-> Redirecting input using the system("irc < input.file")
  69. >This worked and inputted the commands that were contained in input.file 
  70. >but afterwards the IRC program frose on me and would not accept input 
  71. >anymore.
  72. >
  73. >Can anyone help me here?  I would apprecate any help that can be 
  74. offered.
  75. >
  76. >                                - Nicholas Paldino
  77. >                                - np1010@cnsunix.albany.edu
  78.  
  79.